package stack;

import java.util.LinkedList;

public class MyLinkedStack<E> implements MyStack<E> {
    private LinkedList list = new LinkedList();

    @Override
    public void push(E e) {
        list.addFirst(e);
    }

    @Override
    public E pop() {
        return (E) list.removeFirst();
    }

    @Override
    public E peek() {
        return (E) list.getFirst();
    }

    @Override
    public boolean isEmpty() {
        return list.isEmpty();
    }
}
